# Copyright 2024 Ant Group Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@yacl//bazel:yacl.bzl", "yacl_cc_binary", "yacl_cc_library", "yacl_cc_test")

package(default_visibility = ["//visibility:public"])

yacl_cc_library(
    name = "numpy",
    hdrs = ["numpy.h"],
    deps = [
        ":decryptor",
        ":encryptor",
        ":evaluator",
        ":random",
        ":toolbox",
    ],
)

cc_proto_library(
    name = "ic_de_proto",
    deps = ["@org_interconnection//interconnection/runtime:data_exchange"],
)

yacl_cc_library(
    name = "matrix",
    srcs = ["matrix.cc"],
    hdrs = [
        "eigen_traits.h",
        "matrix.h",
        "shape.h",
    ],
    deps = [
        ":ic_de_proto",
        "//heu/library/phe",
        "@com_github_eigenteam_eigen//:eigen3",
        "@yacl//yacl/utils:parallel",
    ],
)

yacl_cc_library(
    name = "encryptor",
    srcs = ["encryptor.cc"],
    hdrs = ["encryptor.h"],
    deps = [
        ":matrix",
        "//heu/library/phe",
        "@yacl//yacl/utils:parallel",
    ],
)

yacl_cc_library(
    name = "decryptor",
    srcs = ["decryptor.cc"],
    hdrs = ["decryptor.h"],
    deps = [
        ":matrix",
        "//heu/library/phe",
        "@yacl//yacl/utils:parallel",
    ],
)

yacl_cc_library(
    name = "evaluator",
    srcs = ["evaluator.cc"],
    hdrs = ["evaluator.h"],
    deps = [
        ":matrix",
        "//heu/library/phe",
    ],
)

yacl_cc_library(
    name = "toolbox",
    srcs = ["toolbox.cc"],
    hdrs = ["toolbox.h"],
    deps = [
        ":matrix",
        "//heu/library/phe",
    ],
)

yacl_cc_library(
    name = "random",
    srcs = ["random.cc"],
    hdrs = ["random.h"],
    deps = [
        ":matrix",
        "//heu/library/phe",
    ],
)

yacl_cc_test(
    name = "random_test",
    srcs = ["random_test.cc"],
    deps = [":random"],
)
